package listener;

import jakarta.servlet.annotation.WebListener;
import jakarta.servlet.http.HttpSessionEvent;
import jakarta.servlet.http.HttpSessionListener;

@WebListener
public class UserSessionListener implements HttpSessionListener
{
	private static int COUNT_ONLINE = 0;
	
	
	public static final int getOnlineUserCount()
	{
		return UserSessionListener.COUNT_ONLINE;
	}
	
	
	public void sessionCreated(HttpSessionEvent se)
	{
		UserSessionListener.COUNT_ONLINE++;
    }
	
	public void sessionDestroyed(HttpSessionEvent se)
	{

		UserSessionListener.COUNT_ONLINE--;
		
    }
}








